package my.diplom.web.ajax;

import org.springframework.web.servlet.view.AbstractCachingViewResolver;
import org.springframework.web.servlet.View;
import org.apache.log4j.Logger;

import java.util.Locale;

/**
 * Created by IntelliJ IDEA.
 * User: gb
 * Date: 13.08.2009
 * Time: 1:28:59
 * To change this template use File | Settings | File Templates.
 */
public class AjaxViewResolver extends AbstractCachingViewResolver {

    private static final Logger log = Logger.getLogger(AjaxViewResolver.class);

    private String ajaxPrefix;
    private View ajaxView;

    @Override
    protected View loadView(String viewName, Locale locale) throws Exception {
        log.info("viewName==>" + viewName);
        View view = null;
        if (viewName.startsWith(this.ajaxPrefix)) {
            view = ajaxView;
        } else {
            
        }
        return view;
    }

    public String getAjaxPrefix() {
        return ajaxPrefix;
    }

    public void setAjaxPrefix(String ajaxPrefix) {
        this.ajaxPrefix = ajaxPrefix;
    }

    public View getAjaxView() {
        return ajaxView;
    }

    public void setAjaxView(View ajaxView) {
        this.ajaxView = ajaxView;
    }
}
